var t = require;
var e = module;
var o = exports;
var n =
        (this && this.__extends) ||
        (function () {
            var t = function (e, o) {
                return (t =
                    Object.setPrototypeOf ||
                    ({__proto__: []} instanceof Array &&
                        function (t, e) {
                            t.__proto__ = e;
                        }) ||
                    function (t, e) {
                        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                    })(e, o);
            };
            return function (e, o) {
                function n() {
                    this.constructor = e;
                }
                t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
            };
        })(),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var r,
                a = arguments.length,
                i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
            return a > 3 && i && Object.defineProperty(e, o, i), i;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var a = t("fsm"),
    i = t("telepoleDefault"),
    s = cc._decorator,
    c = s.ccclass,
    l = s.property,
    u = (function (t) {
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            return (
                (e.telepoleArea = null),
                (e.telepole = null),
                (e.handle = new cc.Component.EventHandler()),
                (e.v2 = cc.v2()),
                e
            );
        }
        var o;
        return (
            n(e, t),
            (o = e),
            (e.prototype.isMove = function () {
                return this.state.isMove();
            }),
            (e.prototype.callHandle = function (t) {
                void 0 === t && (t = !0), this.handle && (t ? this.handle.emit([this.v2]) : this.handle.emit(null));
            }),
            (e.prototype.onLoad = function () {
                this.node.on(cc.Node.EventType.TOUCH_START, this.TOUCH_START, this),
                    this.node.on(cc.Node.EventType.TOUCH_MOVE, this.TOUCH_MOVE, this),
                    this.node.on(cc.Node.EventType.TOUCH_CANCEL, this.TOUCH_END, this),
                    this.node.on(cc.Node.EventType.TOUCH_END, this.TOUCH_END, this),
                    a.changeState(this, i.default),
                    (o.inst = this);
            }),
            (e.prototype.TOUCH_START = function (t) {
                var e = this.node.convertToNodeSpaceAR(t.getLocation());
                this.state.onTouchStart(e);
            }),
            (e.prototype.TOUCH_MOVE = function (t) {
                var e = this.node.convertToNodeSpaceAR(t.getLocation());
                this.state.onTouchMove(e);
            }),
            (e.prototype.TOUCH_END = function () {
                this.state.onTouchEnd();
            }),
            (e.prototype.onDestroy = function () {
                this.node.off(cc.Node.EventType.TOUCH_START, this.TOUCH_START, this),
                    this.node.off(cc.Node.EventType.TOUCH_MOVE, this.TOUCH_MOVE, this),
                    this.node.off(cc.Node.EventType.TOUCH_CANCEL, this.TOUCH_END, this),
                    this.node.off(cc.Node.EventType.TOUCH_END, this.TOUCH_END, this),
                    (o.inst = null);
            }),
            r([l(cc.Node)], e.prototype, "telepoleArea", void 0),
            r([l(cc.Node)], e.prototype, "telepole", void 0),
            r([l(cc.Component.EventHandler)], e.prototype, "handle", void 0),
            (e = o = r([c], e))
        );
    })(cc.Component);
o.default = u;
